﻿// Author: Ben
// Project: CR_RandomBackgroundChanger
// Path: C:\code\CR_RandomBackgroundChanger
// Creation date: 26.04.2008 15:09
// Last modified: 28.04.2008 21:36

#region Using directives
using System;
using DevExpress.CodeRush.Core;
using EnvDTE;
using Project = DevExpress.CodeRush.Core.Project;
#endregion

namespace CR_RandomBackgroundChanger
{
	/// <summary>
	/// Options, just holds all the Options values and provides us with a method
	/// to load the options from BackgroundChangerOptionsPage.Storage.
	/// </summary>
	class Options
	{
		#region Variables
		/// <summary>
		/// Determinates if this plugin is active, if not, nothing
		/// will happen to our sweet code ^^
		/// </summary>
		public static bool enabled = true;

		/// <summary>
		/// Background image directory, sub directories will also be used!
		/// </summary>
		public static string backgroundImageDirectory = "";

		/// <summary>
		/// Transparency for the background image (0-100).
		/// 0 = not visibly at all, 25=default, 100=fully opaque.
		/// </summary>
		public static int transparency = 25;

		/// <summary>
		/// Change the background image every x minutes (see minutesToChangeImage)
		/// </summary>
		public static bool changeImageEveryFewMinutes = true;

		/// <summary>
		/// Change background image every 5 minutes, only used if
		/// changeImageEveryFewMinutes is true!
		/// </summary>
		public static int minutesToChangeImage = 5;

		/// <summary>
		/// Should each document have a different background image (default true)
		/// or should they all just share a single background image (false)?
		/// </summary>
		public static bool useDifferentImagesForDifferentDocuments;
		#endregion

		#region Load
		/// <summary>
		/// Load and set all options, done when initializing and when Options are
		/// changed.
		/// </summary>
		public static void Load()
		{
			DecoupledStorage storage = BackgroundChangerOptionsPage.Storage;

			// Load options
			enabled = storage.ReadBoolean(
				"RandomBackgroundChangerOptions", "Enabled", true);
			backgroundImageDirectory = storage.ReadString(
				"RandomBackgroundChangerOptions", "Directory", "");
			transparency = storage.ReadInt32(
				"RandomBackgroundChangerOptions", "Transparency", 25);
			changeImageEveryFewMinutes = storage.ReadBoolean(
				"RandomBackgroundChangerOptions", "ChangeImageEveryFewMinutes", true);
			minutesToChangeImage = storage.ReadInt32(
				"RandomBackgroundChangerOptions", "MinutesToChangeImage", 5);
			useDifferentImagesForDifferentDocuments = storage.ReadBoolean(
				"RandomBackgroundChangerOptions", "DifferentImages", true);
		} // Load()
		#endregion
	} // class Options
} // namespace CR_RandomBackgroundChanger
